![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
json-stringify-pretty-compact
Advanced tools
Changelog
Version 1.2.0 (2018-04-22)
Readme
The output of JSON.stringify
comes in two flavors: compact and pretty. The
former is usually too compact to be read by humans, while the latter sometimes
is too spacious. This module trades performance (and the “replacer” argument)
for a compromise between the two. The result is a pretty compact string, where
“pretty” means both “kind of” and “nice”.
{
"bool": true,
"short array": [1, 2, 3],
"long array": [
{"x": 1, "y": 2},
{"x": 2, "y": 1},
{"x": 1, "y": 1},
{"x": 2, "y": 2}
]
}
While the “pretty” mode of JSON.stringify
puts every item of arrays and
objects on its own line, this module puts the whole array or object on a single
line, unless the line becomes too long (the default maximum is 80 characters).
Making arrays and objects multi-line is the only attempt made to enforce the
maximum line length; if that doesn’t help then so be it.
npm install json-stringify-pretty-compact
var stringify = require("json-stringify-pretty-compact")
stringify(obj, [options])
It’s like JSON.stringify(obj, null, options.indent)
, except that objects and
arrays are on one line if they fit (according to options.maxLength
).
options
:
JSON.stringify
.false
. Whether or not to add “margins” around brackets
and braces:
false
: {"a": [1]}
true
: { "a": [ 1 ] }
stringify(obj, {maxLength: 0, indent: indent})
gives the exact same result as
JSON.stringify(obj, null, indent)
.
stringify(obj, {maxLength: Infinity})
gives the exact same result as
JSON.stringify(obj)
, except that there are spaces after colons and commas.
MIT.
FAQs
The best of both `JSON.stringify(obj)` and `JSON.stringify(obj, null, indent)`.
The npm package json-stringify-pretty-compact receives a total of 534,315 weekly downloads. As such, json-stringify-pretty-compact popularity was classified as popular.
We found that json-stringify-pretty-compact demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.